{include file="/common/script2" /}
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
      <br>
    <br>
      <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('供应商')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-gongyingshang_id" data-source="pifa/gongyingshang/index" class="form-control selectpage form-control" name="row[gongyingshang_id]" type="text" value="{$row.gongyingshang_id}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('所属门店')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-shangjia_id" data-rule="required" data-source="pifa/shangjia/index" data-multiple="true" class="form-control selectpage form-control" name="row[shangjia_id]" type="text" value="{$row.shangjia_id}">
        </div>
    </div>
    
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Goods_name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-goods_name" data-rule="required" class="form-control form-control" name="row[goods_name]" type="text" value="{$row.goods_name}">
        </div>
    </div>
     <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('商品描述')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-desc"  class="form-control form-control" name="row[desc]" type="text" value="{$row.desc}">
        </div>
    </div>
    <div class="form-group" id="app">
        <label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
        <div class="col-xs-12 col-sm-8">
        <input id="c-category_id" class="form-control form-control"  name="row[category_id]" type="hidden" >
          <el-cascader @change="change" :options="state.options"  collapse-tags  v-model="state.category_id"  :props="state.props"></el-cascader>
        </div>
    </div>
    
       <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('储存方式')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-fangshi" data-rule="required" class="form-control form-control" name="row[fangshi]" type="text" value="{$row.fangshi}">
        </div>
    </div>
      <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('保质期')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-baozhiqi" data-rule="required" class="form-control form-control" name="row[baozhiqi]" type="text" value="{$row.baozhiqi}">
        </div>
    </div>
        

    
    <!--   <div class="form-group">-->
    <!--    <label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>-->
    <!--    <div class="col-xs-12 col-sm-8">-->
         


    <!--          <select id="c-category_id" data-rule="required" class="form-control selectpicker" name="row[category_id]">-->
    <!--            {foreach name="parentList" item="vo"}-->
    <!--            <option data-type="{$vo.name}" value="{$key}" {in name="key" value="$row.category_id"}selected{/in}>{$vo.name}</option>-->
    <!--            {/foreach}-->
    <!--        </select>-->


    <!--    </div>-->
    <!--</div>-->
    
    
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('封面')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-image"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-image"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-images" data-rule="required" class="form-control form-control" size="50" name="row[images]" type="text" value="{$row.images}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-images"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-images"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Spec_type')}:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-spec_type" data-rule="required" class="form-control selectpicker" name="row[spec_type]">
                {foreach name="specTypeList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.spec_type"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>

    <!-- 商品规格属性 start -->
    <div class="goods-spec-many form-group" style="display: <?= $row['spec_type'] === '20' ? 'block' : 'none' ?>;" >
        <!-- <label class="control-label col-xs-12 col-sm-2"></label>-->
        <div class="goods-spec-box col-xs-12 col-sm-11" style="background-color: white;">
            <!-- 规格属性 -->
            <div class="spec-attr"></div>

            <!-- 添加规格：按钮 -->
            <div class="spec-group-button">
                <button type="button" class="btn-addSpecGroup btn btn-xs btn-success">添加规格</button>
            </div>

            <!-- 添加规格：表单 -->
            <div class="spec-group-add">
                <div class="spec-group-add-item form-group">
                    <label class="control-label form-require">规格名 </label>
                    <input type="text" class="input-specName tpl-form-input"
                           placeholder="请输入规格名称">
                </div>
                <div class="spec-group-add-item form-group">
                    <label class="control-label form-require">规格值 </label>
                    <input type="text" class="input-specValue tpl-form-input"
                           placeholder="请输入规格值">
                </div>
                <div class="spec-group-add-item margin-top">
                    <button type="button" class="btn-addSpecName btn btn-xs btn-success"> 确定
                    </button>
                    <button type="button" class="btn-cancleAddSpecName btn btn-xs btn-default"> 取消
                    </button>
                </div>
            </div>
            <!-- 商品多规格sku信息 -->
            <div class="goods-sku scrollable-horizontal">
                <!-- 分割线 -->
                <div class="goods-spec-line"></div>
                <!-- sku 批量设置 -->
                <div class="spec-batch form-inline">
                    <div class="form-group">
                        <label class="control-label">批量设置</label>
                    </div>
                  
                    <div class="form-group">
                        <input type="number" data-type="goods_price" placeholder="零售价格">
                    </div>
                     <div class="form-group">
                        <input type="number" data-type="goods_price2" placeholder="批发价格">
                    </div>
                     <div class="form-group">
                        <input type="number" data-type="goods_price4" placeholder="成本价格">
                    </div>
                     <div class="form-group">
                        <input type="number" data-type="fenyong" placeholder="推广员佣金">
                    </div>
                     <div class="form-group">
                        <input type="number" data-type="qudao_fenyong" placeholder="渠道佣金">
                    </div>
                    
                    <div class="form-group">
                        <input type="number" data-type="line_price" placeholder="划线价">
                    </div>
                    <div class="form-group">
                        <input type="number" data-type="stock_num" placeholder="库存数量">
                    </div>
                     <div class="form-group">
                        <input type="text" data-type="daoqi" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true"  placeholder="到期时间">
                    </div>
                   


                    <div class="form-group">
                        <button type="button" class="btn-specBatchBtn btn btn-sm btn-secondary
                         radius">确定
                        </button>
                    </div>
                </div>
                <!-- sku table -->
                <table class="spec-sku-tabel table table-bordered table-centered margin-bottom-xs text-nowrap"></table>
            </div>
             <div style="display:inline-block;width: 100%;">
        <div class="panel panel-default">
      <div class="panel-heading">规格 × 用户组 定价表</div>
      <div class="panel-body">
        <div id="price-table-container" class="table-responsive"></div>
      </div>
    </div>
   </div>

      <div style="display:inline-block;width: 100%;">
        <div class="panel panel-default">
      <div class="panel-heading">规格 × 区域 定价表</div>
      <div class="panel-body">
        <div id="price-table-container2" class="table-responsive"></div>
      </div>
    </div>
   </div>
        </div>
       

    </div>




    <div class="goods-spec-single" style="display: <?= $row['spec_type'] === '10' ? 'block' : 'none' ?>;">  


        <div class="form-group" style="display: none;">
            <label class="control-label col-xs-12 col-sm-2">商品编码:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-goods_spec_id" class="form-control form-control" name="spec[goods_spec_id]" type="text" value="{$row.spec.0.goods_spec_id}">
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">商品编码:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-goods_no" class="form-control form-control" name="spec[goods_no]" type="text" value="{$row.spec.0.goods_no}">
            </div>
        </div>
         <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">零售价格:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-goods_price"  class="form-control form-control" name="spec[goods_price]" type="number" value="{$row.spec.0.goods_price}">
            </div>
        </div>
         <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">批发价格:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-goods_price2"  class="form-control form-control" name="spec[goods_price2]" type="number" value="{$row.spec.0.goods_price2}">
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">成本价:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-goods_price4"  class="form-control form-control" name="spec[goods_price4]" type="number" value="{$row.spec.0.goods_price4}">
            </div>
        </div>

          <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">保质期到期时间:</label>
        <div class="col-xs-12 col-sm-8">
             <input id="c-daoqi" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="spec[daoqi]" type="text" value="{$row.spec.0.daoqi}">
           
        </div>
    </div>
        
         <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">推广员佣金:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-fenyong"  class="form-control form-control" name="spec[fenyong]" type="number"  step="0.01" value="{$row.spec.0.fenyong}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">渠道佣金:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-qudao_fenyong"  class="form-control form-control" name="spec[qudao_fenyong]" type="number"  step="0.01" value="{$row.spec.0.qudao_fenyong}">
        </div>
    </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">商品划线价:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-line_price" class="form-control form-control" name="spec[line_price]" type="number" value="{$row.spec.0.line_price}">
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">当前库存数量:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-stock_num" class="form-control form-control" name="spec[stock_num]" type="number" value="{$row.spec.0.stock_num}">
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">计量单位:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-danwei" class="form-control form-control" name="spec[danwei]" type="text" value="{$row.spec.0.danwei}">
            </div>
    </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">商品重量(Kg):</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-goods_weight" class="form-control form-control" name="spec[goods_weight]" type="number" value="{$row.spec.0.goods_weight}">
            </div>
        </div>


        <div class="panel panel-default">
      <div class="panel-heading">规格 × 用户组 定价表</div>
      <div class="panel-body">
        <div id="price-table-container" class="table-responsive">
            
           <table class="table table-bordered" style="width:100%;text-align:center;">
    <thead>
        <tr>
            <th>会员组</th>
            <th>价格</th>
            <th>限购数量</th>
            <th>允许订货</th>
        </tr>
    </thead>
    <tbody>
        {volist name="baojia2" id="vo"}
        <tr>
            <td>{$vo.name}</td>
            <td><input type="number" name="baojia_spec[{$vo.id}]" class="form-control input-sm limit-input"value="{$vo.baojia}"></td>
            <td><input type="number" name="baojia_xiangou[{$vo.id}]" class="form-control input-sm limit-input" value="{$vo.xiangou}"></td>

            {if $vo.dinghuo == '1'}
            <td><input type="checkbox" class="allow-order" name="baojia_allow[{$vo.id}]" value="1" checked=""></td>
            {else}
            <td><input type="checkbox" class="allow-order" name="baojia_allow[{$vo.id}]" value="1" ></td>
            {/if}
        </tr>
        {/volist}
    </tbody>
</table>

        </div>
      </div>
    </div>



        <div class="panel panel-default">
      <div class="panel-heading">规格 × 区域 定价表</div>
      <div class="panel-body">
        <div id="price-table-container" class="table-responsive">
            
           <table class="table table-bordered" style="width:100%;text-align:center;">
    <thead>
        <tr>
            <th>区域</th>
            <th>价格</th>
   
        </tr>
    </thead>
    <tbody>
        {volist name="shangjia" id="vo"}
        <tr>
            <td>{$vo.name}</td>
            <td><input type="number" name="baojia_quyu[{$vo.id}]" class="form-control input-sm limit-input"value="{$vo.baojia}"></td>
         
        </tr>
        {/volist}
    </tbody>
</table>

        </div>
      </div>
    </div>

    </div>



    <!-- 商品规格属性 end -->

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Deduct_stock_type')}:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-deduct_stock_type" data-rule="required" class="form-control selectpicker" name="row[deduct_stock_type]">
                {foreach name="deductStockTypeList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.deduct_stock_type"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content"  class="form-control editor form-control" rows="5" name="row[content]" cols="50">{$row.content}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Sales_initial')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-sales_initial" data-rule="required" class="form-control form-control" name="row[sales_initial]" type="number" value="{$row.sales_initial}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Sales_actual')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-sales_actual" data-rule="required" class="form-control form-control" name="row[sales_actual]" type="number" value="{$row.sales_actual}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Goods_sort')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-goods_sort" data-rule="required" class="form-control form-control" name="row[goods_sort]" type="number" value="{$row.goods_sort}">
        </div>
    </div>
    <div class="form-group" style="display: none;">
        <label class="control-label col-xs-12 col-sm-2">{:__('Delivery_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-delivery_id" data-rule="required" data-source="litestore/litestorefreight/index" class="form-control selectpage form-control" name="row[delivery_id]" type="text" value="{$row.delivery_id}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Goods_status')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <div class="radio">
            {foreach name="goodsStatusList" item="vo"}
            <label for="row[goods_status]-{$key}"><input id="row[goods_status]-{$key}" name="row[goods_status]" type="radio" value="{$key}" {in name="key" value="$row.goods_status"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Is_delete')}:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-is_delete" data-rule="required" class="form-control selectpicker" name="row[is_delete]">
                {foreach name="isDeleteList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.is_delete"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
  

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('首页推荐')}:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-home_nav" data-rule="required" class="form-control selectpicker" name="row[home_nav]">
                {foreach name="homelist" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.home_nav"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('是否放心购')}:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-is_fangxin" data-rule="required" class="form-control selectpicker" name="row[is_fangxin]">
                {foreach name="isZhekouList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.is_fangxin"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>



    



    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

{include file="litestore/litestoregoods/spec_many_template" /}

<link rel="stylesheet" href="__CDN__/assets/addons/litestore/css/litestoregoods.css">

<script type="text/javascript">
    var from_specData = <?= $row['specData'] ?>;
</script>